package com.cs.study.homework._0219;

import java.util.zip.CheckedOutputStream;

public class Demo3 {
    public static void main(String[] args) {
        for (int i = 0; i <= 20 ; i++) {
            Student.creatStudent();
        }
    }
}

class Student {
    static int count = 1;
    private Student(){

    }

    public static Student creatStudent() {
        if (count <= 10) {
            Student student = new Student();
            System.out.println("创建第" + count + "个对象");
            count++;
            return student;
        }else {
            System.out.println("创建对象数量超过限额！");
            return null;
        }
    }
}